package cn.wxz1997.permission.exception;

import cn.wxz1997.permission.util.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.sql.SQLException;

/**
 * @Description: 统一异常处理
 * @Author: wxz1997
 * @Date 18-8-5下午8:44
 */
@ControllerAdvice
@ResponseBody
public class GlobalExceptionHandler {

    @ExceptionHandler(SQLException.class)
    public Result handleException(SQLException e) {
        return Result.error(0, "SQL异常!" + e);
    }
}
